﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Computers.aspx.cs" Inherits="Computers_Computers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style>
        .tabs
        {
            background-color:#CCCCCC;
            border: thin none Black;
            text-align:center;
            /*text-decoration: none;
            background-color:Black;*/
            color:White;
            padding:1px;
            
        }
        .tabs:hover
        {
            color:#333;
            cursor:pointer;
            -moz-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); 
	        -webkit-box-shadow:0 2px 5px rgba(0, 0, 0, 0.2);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
            /*
            border-color: #999;*/
        }
        .tabs:active
        {
            color: #000;
            border-color: #444;   
        }
    
    
    </style>


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <div>
        <asp:LinkButton ID="linkAsset" runat="server" Font-Size="Small">Assets</asp:LinkButton>
        &nbsp;
        <asp:Label ID="Label7" runat="server" Text=" > " Font-Size="Small"></asp:Label>
        &nbsp;
        <asp:LinkButton ID="LinkButton6" runat="server" Text="Computer()" onclick="LinkButton6_Click" 
            Font-Size="Small"></asp:LinkButton>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="body" Runat="Server">

    <asp:Button ID="Button2" runat="server" Text="Do Maintenance"  class="google-button-blue"
        style="width:150px; margin-top:2%; margin-right:5%; height:30px; float:right" />

    <div style="background-color:White; padding:2.5%">
        <asp:Label ID="lbAssetHeading" runat="server" Text="Computer Asset" Font-Bold="True" 
            Font-Size="X-Large"></asp:Label>
            <br /><br />
    <asp:Table ID="Table1" runat="server" CellPadding="1" 
            CellSpacing="0">
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="lbComputerID" runat="server" Text="Computer ID: "></asp:Label>
            
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="txtComputerID" runat="server" ReadOnly="True" BorderStyle="None"></asp:TextBox>
            
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="lbComputerName" runat="server" Text="Computer Name: "></asp:Label>
            
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="txtComputerName" runat="server" ReadOnly="True" BorderStyle="None"></asp:TextBox>
            
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="lbLicense" runat="server" Text="License: "></asp:Label>
            
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="txtLicense" runat="server" ReadOnly="True" BorderStyle="None"></asp:TextBox>
            
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="lbSerial" runat="server" Text="Serial: "></asp:Label>
            
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="txtSerial" runat="server" ReadOnly="True" BorderStyle="None"></asp:TextBox>
            
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="lbPurchaseDate" runat="server" Text="Purchase Date: "></asp:Label>
            
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="txtPurchaseDate" runat="server" ReadOnly="True" BorderStyle="None"></asp:TextBox>
            
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="lbLocation" runat="server" Text="Location: "></asp:Label>
            
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="txtLocation" runat="server" ReadOnly="True" BorderStyle="None"></asp:TextBox>

                <asp:DropDownList ID="ddlLocation" runat="server" 
                    DataSourceID="AccessDataSource1" DataTextField="Room_Name" 
                    DataValueField="Room_Name" Visible="False">
                </asp:DropDownList>

                <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
                    DataFile="~/App_Data/Database.accdb"
                    SelectCommand="SELECT DISTINCT [Room_Name] FROM [Classroom]">
                </asp:AccessDataSource>
            
            </asp:TableCell>
            <asp:TableCell runat="server">
                &nbsp; &nbsp; <asp:LinkButton ID="lbtnLocation" runat="server" Visible="False">Add New Location</asp:LinkButton>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="lbWarrenty" runat="server" Text="Warrenty: "></asp:Label>
            
            </asp:TableCell>
            <asp:TableCell>
                <asp:LinkButton ID="hlWarrenty" OnClick="WarrantyLinkButton_Click" runat="server">Valid</asp:LinkButton>

            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                    <asp:Button ID="btnUpdate" runat="server" Text="Update Area" class="button" 
                    style="width:150px; height:30px; top: 0px; left: 0px;" 
                        onclick="btnUpdate_Click" Visible="False" />
            
            </asp:TableCell>
            <asp:TableCell>
                    <asp:Button ID="btnCancle" runat="server" Text="Cancle Update" class="button" 
                    style="width:150px; height:30px; top: 0px; left: 0px;" 
                        onclick="btnCancle_Click" Visible="False" />
            
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                    <asp:Button ID="btnEdit" runat="server" Text="Edit Area" class="button" 
                    style="width:150px; height:30px; top: 0px; left: 0px;" 
                        onclick="btnEdit_Click" />
            
            </asp:TableCell>
            <asp:TableCell>
                    <asp:Button ID="btnDelete" runat="server" Text="Delete Area" class="button" 
                    style="width:150px; top: 0px; left: 0px;" 
                        OnClientClick="return confirm('Are you sure you want to delete this item?\n\nOnce you delete a computer all the parts and installed software assosiated with the computer are delete form the asset control system.');" 
                        onclick="btnDelete_Click" Visible="True" Enabled="True" />
            
            </asp:TableCell>
        </asp:TableRow>

    </asp:Table>

    </div>

    <div style="background-color:#CCCCCC; height:20px; border: thick solid #CCCCCC;">
        <asp:LinkButton ID="LinkButtona" CssClass="tabs" runat="server" OnClick="TabChange">Parts</asp:LinkButton>
        <asp:LinkButton ID="LinkButton2" CssClass="tabs" runat="server" OnClick="TabChange">Software</asp:LinkButton>
        <asp:LinkButton ID="LinkButton3" CssClass="tabs" runat="server" OnClick="TabChange">People</asp:LinkButton>    
    </div>


    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="View1" runat="server">
            <div style="padding:1%">
                <asp:Label ID="Label2" runat="server" Text="Parts that are associated with this computer:"></asp:Label>
                <br />

                <asp:GridView ID="partGridView" runat="server" AutoGenerateSelectButton="True" 
                    CellPadding="5" Font-Size="Small" onrowcreated="partGridView_RowCreated" 
                    onselectedindexchanging="partGridView_SelectedIndexChanging">
                    <SelectedRowStyle ForeColor="#006600" />
                </asp:GridView>

                <br />
                <asp:Panel ID="Panel1" runat="server" >        
                    <asp:Button ID="Button1" runat="server" Text="Install Part" class="google-button-blue"
                        style="float:left; width:80px; height:20px; top: 0px; left: 0px;" 
                        onclick="Button1_Click" Font-Size="X-Small" />
                    <asp:Panel ID="Panel3" runat="server" style="margin-left:110px" >

                    <asp:LinkButton ID="LinkButton1" runat="server" Font-Size="Small" 
                            onclick="LinkButton1_Click">Add New Part</asp:LinkButton>
                    <br />
                    <asp:Label ID="Label4" runat="server" 
                        Text="Select unused existing part to install: " Font-Size="Small"></asp:Label>
                        <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
                            DataFile="~/App_Data/Database.accdb" 
                            SelectCommand="SELECT [Part_Description], [Part_Serial], [Part_Type], [Install_Date], [Part_ID] FROM [Part] WHERE ([Computer_ID] IS NULL)">
                        </asp:AccessDataSource>
                        <asp:GridView ID="intallPartGridView" runat="server" AllowPaging="True" 
                            AllowSorting="True" AutoGenerateColumns="False" CellPadding="3" 
                            DataKeyNames="Part_ID" DataSourceID="AccessDataSource2" Font-Size="Small" 
                            onrowcreated="intallPartGridView_RowCreated" 
                            onselectedindexchanging="intallPartGridView_SelectedIndexChanging" PageSize="5">
                            <Columns>
                                <asp:CommandField ShowSelectButton="True" />
                                <asp:BoundField DataField="Part_ID" HeaderText="Part_ID" ReadOnly="True" 
                                    SortExpression="Part_ID" />
                                <asp:BoundField DataField="Part_Type" HeaderText="Part_Type" 
                                    SortExpression="Part_Type" />
                                <asp:BoundField DataField="Part_Description" HeaderText="Part_Description" 
                                    SortExpression="Part_Description" />
                                <asp:BoundField DataField="Part_Serial" HeaderText="Part_Serial" 
                                    SortExpression="Part_Serial" />
                                <asp:BoundField DataField="Install_Date" HeaderText="Install_Date" 
                                    SortExpression="Install_Date" />
                            </Columns>
                            <EmptyDataTemplate>
                                No uninstalled parts available
                            </EmptyDataTemplate>
                        </asp:GridView>


                    </asp:Panel>
        
                </asp:Panel>
        


                <br />
            </div>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <div style="padding:1%">
                <asp:Label ID="Label1" runat="server" Text=" Software installed on this computer:"></asp:Label>
                <br />
                <asp:GridView ID="installedSoftwareGridView" runat="server" 
                    AutoGenerateSelectButton="True" 
                    onselectedindexchanging="installedSoftwareGridView_SelectedIndexChanging" 
                    CellPadding="5" Font-Size="Small" 
                    onrowcreated="installedSoftwareGridView_RowCreated">
                </asp:GridView>
                <br />

                <asp:Panel ID="Panel2" runat="server" >        
                    <asp:Button ID="Button3" runat="server" Text="Install Software" class="google-button-blue"
                        style="float:left; width:110px; height:20px; top: 0px; left: 0px;" 
                         Font-Size="X-Small" onclick="Button3_Click" />
                    <asp:Panel ID="Panel4" runat="server" style="margin-left:115px" >

                    <asp:LinkButton ID="LinkButton4" runat="server" Font-Size="Small">Add New Software</asp:LinkButton>
                    <br />
                    <asp:Label ID="Label5" runat="server" 
                        Text="Select Software to install on this computer: " Font-Size="Small"></asp:Label>
                        <asp:AccessDataSource ID="AccessDataSource3" runat="server" 
                            DataFile="~/App_Data/Database.accdb" 
                            SelectCommand="SELECT * FROM Software WHERE Software_ID NOT IN (SELECT Software_ID FROM Installed_Software );
">
                        </asp:AccessDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                            AllowSorting="True" AutoGenerateColumns="False" CellPadding="3" 
                            DataKeyNames="Software_ID" DataSourceID="AccessDataSource3" Font-Size="Small" 
                            onrowcreated="GridView1_RowCreated" 
                            onselectedindexchanging="GridView1_SelectedIndexChanging" PageSize="5">
                            <Columns>
                                <asp:CommandField ShowSelectButton="True" />
                                <asp:BoundField DataField="Software_ID" HeaderText="Software_ID" ReadOnly="True" 
                                    SortExpression="Software_ID" />
                                <asp:BoundField DataField="Warranty_ID" HeaderText="Warranty_ID" 
                                    SortExpression="Warranty_ID" />
                                <asp:BoundField DataField="Serial_Key" HeaderText="Serial_Key" 
                                    SortExpression="Serial_Key" />
                                <asp:BoundField DataField="Usage_Terms" HeaderText="Usage_Terms" 
                                    SortExpression="Usage_Terms" />
                                <asp:BoundField DataField="Software_Name" HeaderText="Software_Name" 
                                    SortExpression="Software_Name" />
                                <asp:BoundField DataField="Brand_Name" HeaderText="Brand_Name" 
                                    SortExpression="Brand_Name" />
                            </Columns>
                            <EmptyDataTemplate>
                                No uninstalled parts available
                            </EmptyDataTemplate>
                        </asp:GridView>


                    </asp:Panel>
        
                </asp:Panel>



            </div>
        </asp:View>
        <asp:View ID="View3" runat="server">
            <div style="padding:1%">
                <asp:Label ID="Label3" runat="server" Text="People Allowed to use this computer:"></asp:Label>
                <br />
                <asp:GridView ID="personGridView" runat="server" CellPadding="5" 
                    Font-Size="Small">
                </asp:GridView>
                <br />

                
                <asp:Panel ID="Panel5" runat="server" >        
                    <asp:Button ID="Button4" runat="server" Text="Authorize People" class="google-button-blue"
                        style="float:left; width:110px; height:20px; top: 0px; left: 0px;" 
                         Font-Size="X-Small" onclick="Button4_Click" />
                    <asp:Panel ID="Panel6" runat="server" style="margin-left:115px" >

                    <asp:LinkButton ID="LinkButton5" runat="server" Font-Size="Small">Add New Person</asp:LinkButton>
                    <br />
                    <asp:Label ID="Label6" runat="server" 
                        Text="Authorize existing Person to use this computer: " Font-Size="Small"></asp:Label>
                        <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
                            AllowSorting="True" CellPadding="3" Font-Size="Small" 
                            onrowcreated="GridView2_RowCreated" 
                            onselectedindexchanging="GridView2_SelectedIndexChanging" PageSize="5" 
                            AutoGenerateSelectButton="True">
                            <EmptyDataTemplate>
                                No uninstalled parts available
                            </EmptyDataTemplate>
                        </asp:GridView>


                    </asp:Panel>
        
                </asp:Panel>


            </div>
        </asp:View>
    </asp:MultiView>

    <br />
    
























</asp:Content>

